package com.pickup.rabbitMQ.listener;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;


@Component
public class RabbitMqListener implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback{


    // confirm回调，在生产者将信息发送给交换机时触发，不管成功还是失败都会触发
    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        //System.out.println("confirm");
    }

    // return回调，在交换机将信息发送给队列时触发，只有失败时才触发
    @Override
    public void returnedMessage(Message message, int i, String s, String s1, String s2) {
        //System.out.println("失败： "+message);
    }
}
